package com.bookmanger.controller;

import com.bookmanger.common.result.Result;
import com.bookmanger.entity.Category;
import com.bookmanger.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @folder 分类管理
 */
@RestController
@RequestMapping("/category")
public class CategoryController {

    @Autowired
    CategoryService categoryService;

    /**
     * 获取全部类型
     * @return
     */
    @GetMapping("/categoryALL")
    public Result<List<Category>> getCategoryAll(){
        return categoryService.getCategoryAll();
    }

    /**
     * 获取分类数量
     * @return
     */
    @GetMapping("/getCategoryCount")
    public Result<Integer> getCategoryCount(){
        return categoryService.getCategoryCount();
    }

}
